package com.redteam.xomtro;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;

import com.redteam.xomtro.classes.Support;

import java.util.ArrayList;

/**
 * Created by AnhThuanIT on 5/18/2014.
 */
public class WellcomeActivity extends MasterActivity implements AdapterView.OnItemSelectedListener {
    private View lastSelected;
    public static int widthScreen = 0;
    public static int heightScreen = 0;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        widthScreen = Support.getScreenWidth(this);
        heightScreen = Support.getScreenHeight(this);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wellcome);
        getSupportActionBar().hide();

        TextView tvTimKiem = (TextView)findViewById(R.id.tvTimKiem);
        tvTimKiem.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent i = new Intent(getApplication(), MainActivity.class);
                startActivity(i);
            }
        });
        // Spinner element
        Spinner citySpinner = (Spinner) findViewById(R.id.citySpinner);


        // Spinner click listener
        citySpinner.setOnItemSelectedListener(this);

        // Spinner element
        Spinner districtSpinner = (Spinner) findViewById(R.id.districtSpinner);

        // Spinner click listener
        citySpinner.setOnItemSelectedListener(this);

        // Spinner element
        Spinner typeRoomSpinner = (Spinner) findViewById(R.id.typeRoomSpinner);

        // Spinner click listener
        citySpinner.setOnItemSelectedListener(this);

        // Spinner Drop down elements
        ArrayList<String> city = new ArrayList<String>();
        city.add("Hồ Chí Minh");
        city.add("Đà Lạt");
        city.add("Vũng Tàu");
        city.add("Bình Thuận");
        city.add("Ninh Thuận");
        city.add("An Giang");

        ArrayList<String> district = new ArrayList<String>();
        district.add("Quận 1");
        district.add("Quận 2");
        district.add("Quận 3");
        district.add("Quận 4");
        district.add("Quận 5");
        district.add("Quận 6");

        ArrayList<String> typeRoom = new ArrayList<String>();
        typeRoom.add("Phòng trọ, nhà trọ");
        typeRoom.add("Nhà cho thuê");
        typeRoom.add("Căn hộ chung cư");
        typeRoom.add("Biệt thự, villa");
        typeRoom.add("Nhà nghỉ");



        // Creating adapter for spinner
        ArrayAdapter<String> citiDataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, city);

        // Drop down layout style - list view with radio button
        citiDataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

        // Creating adapter for spinner
        ArrayAdapter<String> districtDataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, district);

        // Drop down layout style - list view with radio button
        districtDataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

        // Creating adapter for spinner
        ArrayAdapter<String> typeRoomDataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, typeRoom);

        // Drop down layout style - list view with radio button
        typeRoomDataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

        // attaching data adapter to spinner
        citySpinner.setAdapter(citiDataAdapter);
        districtSpinner.setAdapter(districtDataAdapter);
        typeRoomSpinner.setAdapter(typeRoomDataAdapter);

    }

    @Override
    public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {

    }

    @Override
    public void onNothingSelected(AdapterView<?> adapterView) {

    }

}
